package comprehensive_case;

import java.util.Random;

public class 随机验证码 {
    public static void main(String[] args) {
        // 要想数组里面存的是字母 必须定义字符类型的数组
        char[] arr = new char[52];
        for (int i = 0; i < arr.length; i++) {
            if (i <= 25) {
                arr[i] = (char) (97 + i);
            } else {
                arr[i] = (char) (65 + i - 26);
            }
        }
        // for (int i = 0; i < arr.length; i++) {
        // System.out.println(arr[i]);
        // }
        Random r = new Random();
        String result = "";
        for (int i = 0; i < 4; i++) {
            int number = r.nextInt(arr.length);
            result += arr[number];
        }
        // System.out.println(result);
        result += r.nextInt(10);
        System.out.println(result);

    }
}
